//
//  BaseViewController.m
//  Deepbreathing
//
//  Created by DreamHack on 15-8-13.
//  Copyright (c) 2015年 DreamHack. All rights reserved.
//

#import "BaseViewController.h"

@interface BaseViewController ()

@end

@implementation BaseViewController

#pragma mark - init
-(void)initBaseApperance{
    [self.view addSubview:self.baseNavigationBar];
    [self.baseNavigationBar addSubview:self.bartitleLabel];
    [self.baseNavigationBar addSubview:self.leftNavButton];
    [self.baseNavigationBar addSubview:self.rightNavButton];
    [self.baseNavigationBar addSubview:self.lineView];
}

#pragma mark - life cycle
- (void)viewDidLoad {
    [super viewDidLoad];
    [self initBaseApperance];
}


#pragma mark - getter
-(UIView *)baseNavigationBar{
    if (!_baseNavigationBar) {
        _baseNavigationBar = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 64) adjustWidth:NO];
        _baseNavigationBar.backgroundColor = [UIColor whiteColor];
    }
    return _baseNavigationBar;
}

-(UIView *)lineView{
    if (!_lineView) {
        _lineView = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(self.baseNavigationBar.frame), CGRectGetWidth(self.baseNavigationBar.frame), 0.5)];
        _lineView.backgroundColor = [UIColor lightGrayColor];
        [_lineView setHidden:YES];
    }
    return _lineView;
}

-(UILabel *)bartitleLabel{
    if (!_bartitleLabel) {
        _bartitleLabel = [[UILabel alloc]init];
        _bartitleLabel.bounds = DHFlexibleFrame(CGRectMake(0, 0, 180, 44), NO);
        _bartitleLabel.center = DHFlexibleCenter(CGPointMake(320 / 2, 20 + 44 / 2));
        [_bartitleLabel setTextColor:[UIColor blackColor]];
        _bartitleLabel.font = [UIFont systemFontOfSize:20 * DHFlexibleVerticalMutiplier()];
        _bartitleLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _bartitleLabel;
}

-(UIButton *)leftNavButton{
    if (!_leftNavButton) {
        _leftNavButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_leftNavButton setFrame:DHFlexibleFrame(CGRectMake(10, 28, 25, 25), NO)];
//        _leftNavButton = [[UIButton alloc]initWithFrame: adjustWidth:YES];
        //_leftNavButton.imageView.contentMode = UIViewContentModeScaleAspectFit;
        
    }
    return _leftNavButton;
}

-(UIButton *)rightNavButton{
    if (!_rightNavButton) {
        _rightNavButton = [[UIButton alloc]initWithFrame:CGRectMake(320 - 5 - 50, 20, 50, 44) adjustWidth:NO];
        _rightNavButton.imageView.contentMode = UIViewContentModeScaleAspectFit;
        
    }
    return _rightNavButton;
}

@end
